//上传文件混入

module.exports = {
    data() {
        return {
            uploadForm: {
                superiorPath: "zhxy_admin_web", //前缀
                compress:true
            }, //上传参数
        };
    },
    computed: {
        //图片url
        url() {
            return this.imgUrl;
        },
    },
    methods: {
        //上传 视频和图片
        async upload(file, superiorPath) {
            const { code, data } = await this.$api.base.uploadImage({
                file,
                superiorPath: superiorPath || this.uploadForm.superiorPath,
            });
            return data;
        },
        // 删除服务器图片
        async delImgs(urlArr) {
           let list =  urlArr.map(v => {
               return v.replace(/^https:\/\/image.yulaisoft.com/,'')
            });
            const { code, data } = await this.$api.base.delImgs(list);
            if (code === 200) {
                console.log("删除图片成功");
            }
        },
        //删除域名
        delDomain(url) {
            return url.replace(this.url, "");
        },
    },
};
